package org.pearl.validation.demo.mapstruct;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;

/**
 * Created by TD on 2021/6/4
 */
@Mapper(componentModel = "spring", typeConversionPolicy = ReportingPolicy.ERROR)
public interface PersonMapper {

    // 日志格式化
    @Mapping(source = "jdkDate", target = "strDate", dateFormat = "yyyy-MM-dd HH:mm")
    // 数字格式化,数字转字符串时才会生效
    @Mapping(source = "money", target = "money", numberFormat = "0.00")
    PersonDTO person2PersonDTO(Person person);
}
